#include<iostream>
using namespace std;

int main() 
{
	float m, n;
	float a, b;
	int isFlag;
	cin >> m >> n;
	float t = n / (float)2;
	a = m;
	b = n;

	while (true)
	{
		if (a < b)
		{
			 b = b - a;
			a = m;
		}
		else if (a > b) 
		{
			a = a - b;
			b = n;
		}
		else if(a==b){
			a = m;
			b = n;
		}
		if (a == m && b == n) {
			isFlag = 0;
			break;
		}
		if (b == t) {
			isFlag = 1;
			break;
		}
	}
	if (isFlag == 1) cout << "Y" << endl;
	else cout << "N" << endl;
	return 0;
}
